package com.huike.web.controller.report;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.domain.vo.IndexVos;
import com.huike.report.service.IReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.controller.BaseController;


@RestController
@RequestMapping("/report")
@Slf4j
public class ReportController extends BaseController {

    @Autowired
    IReportService iReportService;

    /**
     * 漏斗图数据
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */

    @GetMapping("getVulnerabilityMap/{beginCreateTime}/{endCreateTime}")
    public AjaxResult getStatisticsByUser(@PathVariable String beginCreateTime, @PathVariable String endCreateTime) {

        IndexVos indexVos=new IndexVos();

        //获取线索数，有效线索数，商机数，合同数
        Integer cluesNums=iReportService.getcluesNums(beginCreateTime,endCreateTime);
        Integer businessNums=iReportService.getbusinessNum(beginCreateTime,endCreateTime);
        Integer effectiveCluesNums=iReportService.geteffectiveCluesNums(beginCreateTime,endCreateTime);
        Integer contractNums=iReportService.getcontractNums(beginCreateTime,endCreateTime);

        //将其存入IndexVos
        indexVos.setCluesNums(cluesNums);
        indexVos.setBusinessNums(businessNums);
        indexVos.setEffectiveCluesNums(effectiveCluesNums);
        indexVos.setContractNums(contractNums);


        return AjaxResult.success("成功",indexVos);

    }
}